package com.gis.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import com.gis.interceptors.LoginInterceptor;

@Configuration
public class WebConfig implements WebMvcConfigurer{

    @Autowired
    private LoginInterceptor loginInterceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        String[] swaggerExcludes=new String[]{"/swagger-resources/**", "/webjars/**", "/v3/**", "/swagger-ui/**", "/doc.html**", "/error"};
        registry.addInterceptor(loginInterceptor)
        .excludePathPatterns("/user/login**", "/user/register**", "/user/update**")
        .excludePathPatterns(swaggerExcludes);
    }
    
}
